package game;

import game.Config.Config;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;
/**
 * This class represents the Keyboard of the game.
 * The class is used for determining the state of the Keyboard.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class Keyboard {
	private Keyboard(){}
	/**
	 * Updates the keyboard.
	 * Searches the GameContainer of the game for input
	 * and uses the enum GameInput to determine if 
	 * the input is allowed.
	 * @param game	The game we're currently playing.	
	 * @param gc	The GameContainer of the game we're currently playing.
	 */
	public static void update(Game game, GameContainer gc){
		Input input = gc.getInput();
		for(Integer key : Config.KEYMAP.keySet()){
			if(input.isKeyDown(key)){
				game.inputDown(Config.KEYMAP.get(key));
			}
			if(input.isKeyPressed(key)){
				game.inputPressed(Config.KEYMAP.get(key));
			}
		}
	}

}
